<!DOCTYPE HTML>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    <title>index</title>
    <style>
        html {
            margin: 0;
            padding: 0;
            height: 100%;
        }
        
        body {
            margin: 0;
            padding: 0;
        }
        
        canvas {
            width: 100%;
            height: 100%;
        }
    </style>
</head>


<body>
    <button>click</button>
    <script src="https://unpkg.com/rxjs@5.3.0/bundles/Rx.min.js"></script>
    <script>
        var button = document.querySelector("button");
        Rx.Observable.fromEvent(button, "click")
            .throttleTime(1000)
            .map(event => event.clientX)
            .scan((count, clientX) => count + clientX, 0)
            .subscribe(count => console.log(`clicked ${count} times!!`))
    </script>
</body>

</html>